package com.zhj.demo.aop;

import com.zhj.helloframework.aop.annotation.Aspect;
import com.zhj.helloframework.aop.annotation.Order;
import com.zhj.helloframework.aop.aspect.DefaultAspect;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 * @Author: zhj
 * @Description: 切面类
 * @Date: 2021/10/9 16:47
 * @Version: 1.0
 */
@Order(2)
@Slf4j
//@Aspect(pointcut = "within(com.zhj.demo.aop.*)")
@Aspect(pointcut = "execution(* com.zhj.demo.aop..*.*(..))")
public class AspectTest2 extends DefaultAspect {

    @Override
    public void before(Class<?> targetClass, Method method, Object[] args) throws Throwable {
        log.info("AspectTest2#before()方法执行了！");
    }

    @Override
    public Object afterReturning(Class<?> targetClass, Method method, Object[] args, Object returnValue) throws Throwable {
        log.info("AspectTest2#afterReturning()方法执行了！");
        return returnValue;
    }

    @Override
    public void afterThrowing(Class<?> targetClass, Method method, Object[] args, Throwable e) throws Throwable {
        log.info("AspectTest2#afterThrowing()方法执行了！");
    }
}
